<template>
  <el-row :gutter="10">
    <el-col :span="16">
      <div>
        <div>
          <el-dropdown>
            <el-button type="primary" size="small">
              新建处方<i class="el-icon-caret-bottom el-icon--right"></i>
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item @click.native="addWesternMedicine">西医处方</el-dropdown-item>
              <el-dropdown-item @click.native="addChineseMedicine">中医处方</el-dropdown-item>
              <el-dropdown-item @click.native="addCheckProject">检查项目</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
        <el-tabs type="card" :closable="true" style="width:100%;">
          <el-tab-pane v-for="item in recipe" :label="item.label">
            <w-m-mould v-if='item.val==0'
              :basic-info="basicInfo"
              :doctor-info="doctorInfo"
              :current-time="currentTime"
              :allergics="allergics">
            </w-m-mould>
            <t-c-m-mould v-if='item.val==1'
              :basic-info="basicInfo"
              :doctor-info="doctorInfo"
              :current-time="currentTime"
              :allergics="allergics">
            </t-c-m-mould>
            <examine-mould v-if='item.val==2'
              :basic-info="basicInfo"
              :doctor-info="doctorInfo"
              :current-time="currentTime"
              :allergics="allergics">
            </examine-mould>
          </el-tab-pane>
        </el-tabs>
      </div>
    </el-col>
    <el-col :span="8">
    </el-col>
  </el-row>
</template>

<script>
import WMMould from '../recipelMould/WMMould.vue'
import TCMMould from '../recipelMould/TCMMould.vue'
import examineMould from '../recipelMould/examineMould.vue'
export default {
  data() {
    return {
      recipe: [{ label: '西药处方', val: 0 }]
    }
  },
  props: {
    basicInfo: {
      type: Object,
      default: {
        partner_id: 0,
        partner_name: '',
        sex: '',
        age: '',
        birthday: '',
        phone: '',
        street: '',
        allergic_note: '',
      }
    },
    doctorInfo: null,
    currentTime: null,
    allergics: {
      type: Array,
      default: []
    }
  },
  components: {
    WMMould,
    TCMMould,
    examineMould
  },
  methods: {
    addWesternMedicine() {
      let vm = this
      vm.recipe.push({ label: '西药处方', val: 0 })
    },
    addChineseMedicine() {
      let vm = this
      vm.recipe.push({ label: '中药处方', val: 1 })
    },
    addCheckProject() {
      let vm = this
      vm.recipe.push({ label: '检查项目', val: 2 })
    }
  }
}
</script>